package Upcasting_Downcasting_Classes;


class SuperClass {}  

public class SubClass extends SuperClass {
	public static void main(String[] x) {  
		SubClass sub = (SubClass) new SuperClass();      //1. ClassCastException   
		   
		SuperClass sup = (SuperClass) new SubClass();    
		SubClass sub1 = (SubClass) sup;                //2. ok, why?  
		

		}  

}
